package chapter01;

import java.util.Scanner;

public class Test10_Day3 {
    public static void main(String[] args) {
        System.out.println("请输入年月日：");
        Scanner scanner = new Scanner(System.in);
        int year = scanner.nextInt();
        int month = scanner.nextInt();
        int day = scanner.nextInt();
        //定义一个数组放每个月的天数
        int[] days = {31,28,31,30,31,30,31,31,30,31,30,31};
        boolean flag = year%4==0&&year%100!=0||year%400==0;
        if(flag){
            days[1] = 29;
        }
        int dayOfYear = 0;
        for(int i=0;i<month-1;i++){
            dayOfYear = dayOfYear+days[i];
        }
        dayOfYear+=day;
        System.out.println("该日期是当前年份第"+dayOfYear+"天");
    }
}
